package com.atguigu.exam;

import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;

/**
 * @author xbd
 * @create 2021-05-28 10:18
 */
public class CollectionTest {
    public static void main(String[] args) {
        Collection coll1 = new HashSet();

        coll1.add(123);
        coll1.add(569);
        coll1.add("AA");
        Iterator iterator = coll1.iterator();
        while(iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("*************");

        HashSet coll2 = new HashSet();
        coll2.add("CC");
        coll2.add(12.56);
        coll2.add(false);

        coll1.addAll(coll2);
        Iterator iterator1 = coll1.iterator();
        while (iterator1.hasNext()){
            System.out.println(iterator1.next());
        }
        System.out.println("*************");

        coll1.remove(569);
        for(Object obj : coll1){
            System.out.println(obj);
        }
        System.out.println("*************");

        System.out.println(coll2.contains(665));
        System.out.println(coll2.contains(false));

        System.out.println(coll1.isEmpty());

        coll2.clear();
        System.out.println("*************");
        for(Object obj : coll2){
            System.out.println(obj);
        }

        System.out.println(coll1.size());
    }
}
